package leetcode;

/**
 * 27. 移除元素
 */
public class Solution27 {
    public int removeElement(int[] nums, int val) {
        if(nums == null){
            return 0;
        }
        int slow=0,fast =0;
        while(fast < nums.length){
            if(nums[fast] != val){
                nums[slow] = nums[fast];
                slow++;
            }
            fast++;
        }
        return slow;
    }
}
